#include "item.h"

#include <iostream>
#include <ctime>
#include <QGraphicsScene>
#include <QPainter>
#include <QStyleOption>




QRectF Item::boundingRect() const
{
    return QRectF(0, 0, 400, 400);
}

void Item::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
 {



    for(short i=0; i<x;++i ){
        for(short j=0; j<x; ++j){
            switch(board[i][j]){
                case 1:
                    painter->setBrush(QColor(0,255,0));
                    painter->drawRect(i*8,j*8,8,8);
                    break;
                case 2:
                    painter->setBrush(QColor(255,0,0));
                    painter->drawRect(i*8,j*8,8,8);
                    break;
                case 3:
                    painter->setBrush(QColor(0,0,255));
                    painter->drawRect(i*8,j*8,8,8);
                    break;
                case 4:
                    painter->setBrush(QColor(255,0,255));
                    painter->drawRect(i*8,j*8,8,8);
                    break;
                case -1:
                    painter->setBrush(QColor(255,255,0));
                    painter->drawEllipse(i*8,j*8,8,8);
                    break;
           }


        }
    }

    /*
    // Body
     painter->setBrush(color);
     painter->drawEllipse(-10, -20, 20, 40);

     // Eyes
     painter->setBrush(Qt::white);
     painter->drawEllipse(-10, -17, 8, 8);
     painter->drawEllipse(2, -17, 8, 8);

     // Nose
     painter->setBrush(Qt::black);
     painter->drawEllipse(QRectF(-2, -22, 4, 4));

     // Pupils
     painter->drawEllipse(QRectF(-8.0 , -17, 4, 4));
     painter->drawEllipse(QRectF(4.0 , -17, 4, 4));



     // Tail
     QPainterPath path(QPointF(0, 20));
     path.cubicTo(-5, 22, -5, 22, 0, 25);
     path.cubicTo(5, 27, 5, 32, 0, 30);
     path.cubicTo(-5, 32, -5, 42, 0, 35);
     painter->setBrush(Qt::NoBrush);
     painter->drawPath(path);
     */
 }
